<template>
  <div>
    <a-card class="info" title="还款单">
      <template slot="extra">
        <!--迭代11 改为审批流程 2022年10月26日10:41:50-->
        <!-- <template v-if="model.auditStatus==0">
        <a-button
                class="ruleButton"
                :ghost="true"
                type="primary"
                icon="edit"
                @click="handleEdit(model)"
                :disabled="isDisabledAuth('erpFinanceRepaymentSlip:edit')"
        />
          <a-divider type="vertical"/>
          <a-popconfirm title="确定提交吗?" @confirm="() => handleSubmit(model.id)">
            <a-button type="primary" size="small" :disabled="isDisabledAuth('erpFinanceRepaymentSlip:submit')">提交</a-button>
          </a-popconfirm>
        </template> -->
        <!-- <template v-if="model.auditStatus==1">
          <a-button type="primary" size="small" @click="handleAudit(model.id)"  :disabled="isDisabledAuth('erpFinanceRepaymentSlip:audit')">审核</a-button>
        </template> -->
        <!-- <template v-if="model.auditStatus==2">
          <a-popconfirm title="确定反审吗?" @confirm="() => handleCounterTrial(model.id)">
            <a-button type="primary" size="small" :disabled="isDisabledAuth('erpFinanceRepaymentSlip:counterTrial')">反审</a-button>
          </a-popconfirm>
        </template> -->
        <template v-if="model.bpmStatus !== '1'">
          <a-button type="primary" size="small" @click="handleTrack(model)" :disabled="isDisabledAuth('erpFinanceRepaymentSlip:viewTrack')">审批进度</a-button>
        </template>
      </template>
      <a-row type="flex" justify="center">
        <a-col :span="24">
          <erp-finance-repayment-slip-form ref="realForm" :disabled="true" normal :detail="true"></erp-finance-repayment-slip-form>
        </a-col>
      </a-row>
      <a-row type="flex" justify="center">
        <a-col :span="24">
          
          <!-- 流程历史跟踪 -->
          <common-flow-list v-if="model.bpmStatus !== '1'" :formData="formData"></common-flow-list>
        </a-col>
      </a-row>
      <!-- <a-row type="flex"  justify="center">
       <a-col :span="24">
          <erp-finance-repayment-slip-form ref="realForm" :disabled="true" normal></erp-finance-repayment-slip-form>
       </a-col>
      </a-row> -->
      <erp-finance-repayment-slip-modal ref="modalForm" @ok="modalFormOk"></erp-finance-repayment-slip-modal>
      <!-- <audit-modal ref="auditModal" @ok="modalFormOk"></audit-modal> -->
      <bpm-biz-task-deal-modal
        ref="taskDealModal"
        :path="path"
        :formData="formData"
        @ok="handleOk"></bpm-biz-task-deal-modal>
      <bpm-process-track-modal ref="bpmProcessTrackModal"></bpm-process-track-modal>
      <biz-task-notify-modal ref="taskNotifyModal"></biz-task-notify-modal>
      <biz-task-notify-me-modal ref="taskNotifyMeModal"></biz-task-notify-me-modal>
    </a-card>
    <div style="text-align: center;margin-top: 15px;">
      <a-button type="primary" @click="onPrint">打印</a-button>
    </div>
    <erp-finance-repayment-slip-form-print class="print_style" id="printContent" :formData="model" :formDataHistory="formData"></erp-finance-repayment-slip-form-print>
  </div>
</template>

<script>

  import { getAction } from '@/api/manage'
  // import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import { JeecgBpmListMixin } from '@/mixins/JeecgBpmListMixin'
  import ErpFinanceRepaymentSlipForm from './modules/ErpFinanceRepaymentSlipForm'
  import ErpFinanceRepaymentSlipFormPrint from './modules/ErpFinanceRepaymentSlipFormPrint'
  import ErpFinanceRepaymentSlipModal from './modules/ErpFinanceRepaymentSlipModal'
  import {DisabledAuthFilterMixin} from '@/mixins/DisabledAuthFilterMixin';
  import CommonFlowList from '@/views/components/CommonFlowList';
  import BpmBizTaskDealModal from '@/views/modules/bpmbiz/common/BpmBizTaskDealModal.vue';
  import BpmProcessTrackModal from '@/views/modules/bpmbiz/common/BpmProcessTrackModal.vue';
  import BizTaskNotifyModal from '@/views/modules/bpmbiz/common/BizTaskNotifyModal.vue';
  import BizTaskNotifyMeModal from '@/views/modules/bpmbiz/common/BizTaskNotifyMeModal.vue';
  import BizHisTaskModule from '@/views/modules/bpmbiz/common/BizHisTaskModule.vue';
  import Print from '@/utils/print/printarea.js';
  export default {
    name: 'ErpFinanceRepaymentSlipDetail',
    mixins: [JeecgBpmListMixin, DisabledAuthFilterMixin],
    components: {
      ErpFinanceRepaymentSlipForm,
      ErpFinanceRepaymentSlipModal,
      BizHisTaskModule,
      BpmBizTaskDealModal,
      BpmProcessTrackModal,
      BizTaskNotifyModal,
      BizTaskNotifyMeModal,
      CommonFlowList,
      ErpFinanceRepaymentSlipFormPrint
    },
    data () {
      return {
         model: {},
        timer: null,
        id: '',
        url: {
          queryById: "/api/erp/finance/repayment/erpFinanceRepaymentSlip/queryById",
          delete: "/api/erp/finance/repayment/erpFinanceRepaymentSlip/delete",
          submit: "/api/erp/finance/repayment/erpFinanceRepaymentSlip/submit",
          revoke: "/api/erp/finance/repayment/erpFinanceRepaymentSlip/revoke",
          counterTrial: "/api/erp/finance/repayment/erpFinanceRepaymentSlip/counterTrial",
          audit: "/api/erp/finance/repayment/erpFinanceRepaymentSlip/audit",
          overrule: "/api/erp/finance/repayment/erpFinanceRepaymentSlip/overrule",
          bizCount: '/api/erp/finance/repayment/erpFinanceRepaymentSlip/bizCount'
        },
        confirmLoading: false,
        iconStyle:{"font-size":"20px"},
        flowCode: 'onl_erp_finance_repayment_slip',
        formUrl: "/erp/finance/repayment/modules/ErpFinanceRepaymentSlipForm",
        formUrlMobile: "",
      }
    },
    created() {
    },
    watch: {
      $route(to, from) {
        this.loadData();
      },
    },
    mounted() {
    },
    methods: {
      // loadData() {
      //   const id = this.$route.params.id;
      //   getAction(this.url.queryById, { id }).then((res) => {
      //     if (res.success) {
      //       const model = res.result
      //       this.$refs.realForm.edit(model);
      //       this.model=model;
      //     }
      //   })
      // },
      loadData() {
        const id = this.$route.params.id;
        getAction(this.url.queryById, { id }).then((res) => {
          if (res.success) {
            const model = res.result
            this.$refs.realForm.edit(model);
            this.model = model;
            // 查询催办
            let params1 = { flowCode: this.flowCode, dataId: id };// 查询条件
            getAction(this.url.checkNotify, params1).then((res2) => {
              if (res2.result) {
                this.model.taskUrge = true;
              }
            })
            // 查询流程
            let params = { flowCode: this.flowCode, dataId: this.model.id };// 查询条件
            this.viewTrack(params);
          }
        })
        this.bizCountById(id);
      },

      // 点击打印
      onPrint () {
        this.$nextTick(() => {
          let print = new Print({
          el: '#printContent'
        })
        })
      },
    }
  }
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.info {
  /deep/ .ant-card-head-title{
    flex: none;
    margin-right: 20px;
  }
  /deep/ .ant-card-extra{
    flex: 1;
    float: left;
  }
}
.print_style{
  position: absolute;
  top: 0;
  z-index: -1111;
}
</style>
